import {ADD_PERSON} from "../constants";

const initState = [
  {id: '001', name: 'Samuel', age: 26}
];

const personReducer = (prevState = initState, action) => {
  const {type, data} = action;
  switch (type){
    case ADD_PERSON:
      return [data, ...prevState];
    default:
      return prevState
  }
}

export default personReducer
